﻿using System;
using System.Collections.Generic;

namespace CommonModel.Model
{
    public class SchemaDocument
    {

		// 解析规则名称
		private string name;
		private string file_name;
		private string id;

		//用于区分解析命令码或结构体
		private string msgType;

		//用于区分解析多种命名对应一个XML
		private string xmlType;

		// 规则字典
		private Dictionary<int, Object> fieldDictionary;
		// 动态参数字典, 用于记录结构体数组动态变化的变量与其值
		private Dictionary<string, string> dynamicParaDictionary;

		// private List<FieldData> fieldList;

		public SchemaDocument()
		{
		}

		public string getName()
		{
			return name;
		}

		public void setName(string name)
		{
			this.name = name;
		}

		public string getId()
		{
			return id;
		}

		public void setId(string id)
		{
			this.id = id;
		}

		public string getFile_name()
		{
			return file_name;
		}

		public void setFile_name(string file_name)
		{
			this.file_name = file_name;
		}

		public string getMsgType()
		{
			return msgType;
		}

		public void setMsgType(string msgType)
		{
			this.msgType = msgType;
		}

		public string getXmlType()
		{
			return xmlType;
		}

		public void setXmlType(string xmlType)
		{
			this.xmlType = xmlType;
		}

		public Dictionary<int, Object> getFieldDictionary()
		{
			return fieldDictionary;
		}

		public void setFieldDictionary(Dictionary<int, Object> fieldDictionary)
		{
			this.fieldDictionary = fieldDictionary;
		}

		public Dictionary<string, string> getDynamicParaDictionary()
		{
			return dynamicParaDictionary;
		}

		public void setDynamicParaDictionary(Dictionary<string, string> dynamicParaDictionary)
		{
			this.dynamicParaDictionary = dynamicParaDictionary;
		}

		/*public int getPackageLength()
		{
			int length = 0;
			foreach(int key in fieldDictionary.Keys) 
			{
                if (key is SchemaDictionary) //判断key是否是SchemaDictionary类
                {
					SchemaDictionary field = (SchemaDictionary)fieldDictionary[key];
					length += field.getSize();
				} else if (key is FieldSchema) 
				{
					FieldSchema field = (FieldSchema)fieldDictionary[key];
					length += field.getSize();
				}
			}
			return length;
		}*/
	}
}
